package com.woniu.woniuproject.controller.admin;

import com.github.pagehelper.PageInfo;
import com.woniu.woniuproject.entity.Account_log;
import com.woniu.woniuproject.service.systemService;
import com.woniu.woniuproject.utils.ResponseResult;
import com.woniu.woniuproject.vo.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 功能描述:<br>
 * 〈〉
 *
 * @author EDZ
 * @create 2020/11/17
 * @since 1.0.0
 */
@RestController
@RequestMapping("System")
public class SystemController {

    @Autowired
    systemService systemService;

    @GetMapping("queryall")
    public ResponseResult<PageInfo<Account_log>> queryall(Page page, String startDate, String endDate){
        Date startDates = null;
        Date endDates = null;
        try {
            if (startDate!=null&&endDate!=null){
                startDates = new SimpleDateFormat( "yyyy-MM-dd").parse(startDate);
                endDates = new SimpleDateFormat( "yyyy-MM-dd").parse(endDate);
            }
        } catch (ParseException e) {
            e.printStackTrace();
        }
        PageInfo<Account_log> pageInfo=systemService.queryeryall( page,startDates, endDates);
        return new ResponseResult<>(pageInfo);
    }
}